﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js"></script>
</head>
<body>
		<table border="1px" align="center">
			<tr>
				<th>userid</th>
				<th>userName</th>
				<th>userPassword</th>
				<th>userRegistrationTime</th>
				<th>修改</th>
			</tr>
			<c:if test="${empty list}">
				<tr>
					<td colspan="7">暂无用户</td>
				</tr>			
			</c:if>
			<c:if test="${not empty list}">
				<form id="formID" action="${pageContext.request.contextPath}/product" method="post">
				<input type="hidden" name="method" value="delCheck">
				<c:forEach items="${list}" var="pro">
					<tr>
						<td><input type="checkbox" name="id" value="${pro.pid}" ></td>
						<td>${pro.userid}</td>
						<td>${pro.userName}</td>
						<td>${pro.userPassword}</td>
						<td>${pro.userRegistrationTime}</td>	
						<td>
							<a href="${pageContext.request.contextPath}/product?method=edit&id=${pro.pid}">修改</a>
							<a href="#" onclick="del('${pro.pid}')">删除</a>
						</td>
					</tr>
				</c:forEach>
			</c:if>
		</table>
</body>
<script type="text/javascript">
	function del(id){
		var flag=confirm("您确认要删除吗?");
		if(flag){
			//执行删除操作
			location.href="${pageContext.request.contextPath}/product?method=delete&userid="+userid;
		}
	}
	
	
	
	
	
	/* $("#thId").click(function(){
		//获取表头复选框选中状态
		//$("#thId").prop("checked");
		//使列表中复选框选中状态和表头一致
		$("[name=id]").prop("checked",$("#thId").prop("checked"));
	}) */
	
	
	//给按钮派发单击事件，提交表单
</script>
</html>